package com.rzrk.centerlogserver.action;

import java.util.Enumeration;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.support.RequestContextUtils;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;

import com.exp.base.util.SpringUtils;

@Controller
@RequestMapping("/")
public class MainAction extends BaseAction {

	@RequestMapping("/")
	public String index(HttpServletRequest request){
		ServletContext servletContext  = request.getServletContext();
//		{
//			Enumeration<String> enumattr = servletContext.getAttributeNames();
//			while(enumattr.hasMoreElements()){
//				String attrName = enumattr.nextElement();
//				Object attrObj = servletContext.getAttribute(attrName);
//				System.out.println(attrObj);
//			}
//		}
//		{
//			Enumeration<String> enumattr = request.getAttributeNames();
//			while(enumattr.hasMoreElements()){
//				String attrName = enumattr.nextElement();
//				Object attrObj = request.getAttribute(attrName);
//				System.out.println(attrObj);
//			}
//		}
//		
//		
//		WebApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
//		WebApplicationContext context = RequestContextUtils.getWebApplicationContext(request);
//		ViewResolver springResolver = (ViewResolver) springContext.getBean("viewResolver");
//		ViewResolver resolver = (ViewResolver) context.getBean("viewResolver");
		return "main/main_index";
	}
	
}
